package com.bwie.controller;

import com.bwie.pojo.TProd;
import com.bwie.service.TbOrderService;
import com.bwie.utils.R;
import com.bwie.vo.PageInfoVo;
import com.bwie.vo.PageOrderVo;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author : Yoo19
 * @description :
 * @createDate : 2025/4/21 18:51 51
 */
@RestController()
@RequestMapping("/order/index")
public class IndexController {
    @Autowired
    private TbOrderService tbOrderService;
    @PostMapping("/getOrderById/{id}")
    public R getOrderById(@PathVariable(name = "id")Integer id ){
        return tbOrderService.getOrderById(id);
    }

    @PostMapping("/getOrderList")
    public R getOrderList(@RequestBody PageOrderVo pageInfoVo){
        return tbOrderService.getOrderList(pageInfoVo);
    }

    @ApiOperation("下单")
    @PostMapping("addOrder")
    public R addOrder(@RequestBody List<TProd> prodList){
        return tbOrderService.addOrder(prodList);
    }

}
